<template>
	<!-- 商家端提现 -->
	<view class="tx">
		<view class="weix">
			<view class="text">选择提现方式</view>
			<view class="weixinzf flex-cb">
				<view class="weixin_img flex align-center">
					<view class="cuIcon-weixin flex-c"></view>
					<text>微信支付</text>
				</view>
				<text class="cuIcon-roundcheckfill" v-if="ischoice" @click="ischoice = 0"></text>
				<text class="cuIcon-round" v-else @click="ischoice = 1"></text>
			</view>
			<view class="weixinzf flex-cb yhk" v-if="banklist.length > 0">
				<view class="weixin_img flex align-center">
					<image src="/static/yhk.png" mode="" style="width: 50rpx;height: 50rpx;"></image>
					<text>银行卡</text>
				</view>
				<text class="cuIcon-roundcheckfill" v-if="!ischoice" @click="ischoice = 1"></text>
				<text class="cuIcon-round" v-else @click="ischoice = 0"></text>
			</view>
			<view class="addbank flex-cb" v-if="banklist.length == 0">
				<!-- <navigator url="./bank" >添加银行卡</navigator> -->
				<view @click="addBank">添加银行卡</view>
				<!-- <navigator url="./mybank">我的银行卡</navigator> -->
			</view>
		</view>
		
		<view class="weixin_monye weix">
			<view class="text">提现金额</view>
			<view class="input flex align-center">
				<text>￥</text>
				<input type="digit" placeholder="请输入想要提现的金额" v-model="amount" placeholder-style="color:#ccc;font-size:28rpx">
			</view>
			<view class="solid"></view>
			<view class="foot">
				<!-- <text>￥100.00</text> -->
				<!-- <text class="qbtx">提现手续费：20%</text> -->
			</view>
		</view>
		<view class="button flex-c" @click="qrue">提交</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				ischoice:1,//1微信 0银行卡
				banklist:[],
				amount:0,
				
			};
		},
		onLoad(){
			
		},
		onShow(){
			this.$api.my_bank().then(res=>{
				console.log(res);
				this.banklist = res.data
			})
		},
		methods:{
			addBank(){
				let time = Math.round(new Date().getTime()/1000).toString();
				console.log(time < 1681898400,time,'time===');
				if( time < 1681898400){
					uni.navigateTo({
						url:'../../pages/index'
					})
					return
				}
				uni.navigateTo({
					url:'/pageA/admin/bank'
				})
			},
			qrue(){
				if(this.ischoice == 1){//微信提现
					this.$api.withdraw({
						method:1,
						amount:this.amount,
						bank_id:null
					},1).then(res=>{
						if(res.code == 200001){
							uni.showToast({
								icon:"none",title:"提交成功"
							})
							uni.navigateBack({
								delta: 1
							})
						}
					})
				}else{
					this.$api.withdraw({//银行卡提现
						method:2,
						amount:this.amount,
						bank_id:this.banklist[0].id
					},1).then(res=>{
						if(res.code == 200001){
							uni.showToast({
								icon:"none",title:"提交成功"
							})
							uni.navigateBack({
								delta: 1
							})
						}
					})
				}
			}
		}
	}
</script>

<style lang="scss">
.tx{padding-top: 50rpx;}
.yhk{
	margin-top: 55rpx;
}
.addbank{
	color: #1CD699;
	font-size: 32rpx;
	height: 45rpx;
	margin-top: 41rpx;
}
.weix{
	width: 690rpx;
	height: auto;
	background: #FFFFFF;
	box-shadow: 0px 0px 20rpx 1rpx rgba(71,71,71,0.09);
	border-radius: 20rpx;
	margin: auto;
	padding: 34rpx 40rpx 38rpx 38rpx;
	.text{
		color: #333;
		font-size: 34rpx;
		font-weight: bold;
		margin-bottom: 39rpx;
	}
	.weixinzf{
		.weixin_img{
			.cuIcon-weixin{
				width: 50rpx;
				height: 50rpx;
				font-size: 36rpx;
				padding-bottom: 5rpx;
				color: #FFFFFF;
				background: #3EB135;
				border-radius: 50%;
			}
			text{
				font-size: 32rpx;
				margin-left: 19rpx;
			}
		}
		.cuIcon-roundcheckfill,.cuIcon-round{
			font-size: 44rpx;
			color: #1CD699;
		}
		.cuIcon-round{
			color: #CCCCCC;
		}
	}
}
.weixin_monye{
	width: 690rpx;
	height: 460rpx;
	background: #FFFFFF;
	box-shadow: 0px 0px 20rpx 1rpx rgba(71,71,71,0.09);
	border-radius: 20rpx ;
	margin: 30rpx auto;
	padding-right: 30rpx;
	.text{
		margin-bottom: 55rpx;
	}
	.input{
		text{
			font-size: 34rpx;
		}
		input{
			width: 280rpx;
			height: 40rpx;
			margin-left: 12rpx;
		}
	}
	.solid{
		width: 570rpx;
		margin: auto;
		margin-top: 33rpx;
	}
	.foot{
		padding-top: 11rpx;
		text-align: right;
		font-size: 26rpx;
		font-weight: bold;
		text{
			margin-left: 20rpx;
		}
		.qbtx{
			// color: #1CD699;
			color: #999999;
		}
	}
}
.button{
	width: 648rpx;
	height: 80rpx;
	background: #1CD699;
	border-radius: 10rpx;
	color: #FFFFFF;
	position: absolute;
	bottom: 157rpx;
	left: 51rpx;
	z-index: 0;
}
</style>
